package com.lyshop.guiyingshanding.adapters;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.core.content.ContextCompat;


import com.lyshop.guiyingshanding.R;
import com.lyshop.guiyingshanding.base.BaseRVAdapter;
import com.lyshop.guiyingshanding.base.BaseRVHolder;
import com.lyshop.guiyingshanding.bean.UserMessageBean;
import com.lyshop.guiyingshanding.utils.DataTimeUtils;

import java.util.List;


public class MessageListAdapter extends BaseRVAdapter<UserMessageBean> {


    public MessageListAdapter(Context context, List<UserMessageBean> list) {
        super(context, list);
    }

    @Override
    public int onCreateViewLayoutID(int viewType) {
        return R.layout.item_my_message;
    }

    @Override
    public void onBindView(BaseRVHolder holder, int position) {

        UserMessageBean bean = mList.get(position);

        TextView tv_title = holder.getViewHolder().get(R.id.tv_title);
        TextView tv_time = holder.getViewHolder().get(R.id.tv_time);
        TextView tv_remind = holder.getViewHolder().get(R.id.tv_remind);
        ImageView iv_dot = holder.getViewHolder().get(R.id.iv_dot);

        tv_title.setText(bean.content);
        tv_time.setText(DataTimeUtils.formatYHDHMTime(bean.add_time * 1000));

        if (bean.send_type == 0) {
//            iv_dot.setVisibility(View.VISIBLE);
            tv_remind.setText("未读");
            tv_remind.setTextColor(ContextCompat.getColor(mContext, R.color.buy_red));
        } else {
//            iv_dot.setVisibility(View.GONE);
            tv_remind.setText("已读");
            tv_remind.setTextColor(ContextCompat.getColor(mContext, R.color.color_black_03));
        }

    }
}
